﻿@model List<CoffeeMobile.Models.TableGroup>
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section Header{
    @Html.ActionLink("Trang chủ", "Index", "Home", null, new Dictionary<string, object> { { "data-icon", "home" }, { "class", "ui-btn-left" } })
    <h1>@ViewBag.Title</h1>
}
@if (ViewBag.ErrorMsg != null) { 
<p style="color:Red;">@ViewBag.ErrorMsg</p>
}
<ul data-role="listview" data-filter="true" data-filter-placeholder="Nhập tên bàn ăn cần tìm...">
    @foreach (var item in ViewBag.TableGroups)
    {
        {
            Html.ViewContext.Writer.Write("<li><a href='#pu" + @item.ID + "' data-rel='popup' data-transition='slidedown'>");
            Html.ViewContext.Writer.Write(@item.Name);
            Html.ViewContext.Writer.Write("</a></li>");
            Html.ViewContext.Writer.Write("<div data-role='popup' class='ui-corner-all' style='min-width:210px;min-height:100px;' id='pu" + @item.ID + "'>");
            Html.ViewContext.Writer.Write("<a href='#' data-rel='back' data-role='button' data-theme='a' data-icon='delete' data-iconpos='notext' class='ui-btn-right'>Close</a>");
            Html.ViewContext.Writer.Write("<div style='padding:10px;'>");
            //Html.ViewContext.Writer.Write("<a href='/TableGroups/Details/" + @item.ID + "' id='btnEdit' data-role='button' data-theme='b' data-icon='info'>Chi tiết</a>");
            Html.ViewContext.Writer.Write("<a href='/TableGroups/Edit/" + @item.ID + "' id='btnEdit' data-role='button' data-theme='b' data-icon='edit'>Chỉnh sửa</a>");
            Html.ViewContext.Writer.Write("<a href='/TableGroups/Delete/" + @item.ID + "' onclick='' data-role='button' data-theme='b' data-icon='delete'>Xóa</a>");
            Html.ViewContext.Writer.Write("</div>");
            Html.ViewContext.Writer.Write("</div>");
        }
    }
</ul>
@section footer{
    <div data-role="navbar" data-iconpos="top">
        <ul id="mylist">
            <li>@Html.ActionLink("Thêm mới", "Create", "TableGroups", new { }, new Dictionary<string, object> { })</li>
            <li>@Html.ActionLink("Làm mới", "Clear", "Tables", new { }, new Dictionary<string, object> { })</li>
        </ul>
    </div>
}
